package com.hknc.btscale.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;

public class MyViewPager extends ViewPager {
    private boolean DISABLE = false;

    public MyViewPager(@NonNull Context context) {
        super(context);
    }

    public MyViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    //禁止手动滑动viewpager
    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        return DISABLE && super.onInterceptTouchEvent(arg0);
    }
    //禁止手动滑动viewpager
    @Override
    public boolean onTouchEvent(MotionEvent arg0) {
        return DISABLE && super.onTouchEvent(arg0);
    }

}
